<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<ul id="box">

</ul>
<input type="text" id="txt">
<input type="button" value="添加" id="btn">
<script>
   var btn = document.getElementById('btn');
   var txt = document.getElementById('txt');
   var box = document.getElementById('box');
   btn.onclick = function(){
       var li = document.createElement('li');
       var text = document.createTextNode(txt.value);
       li.appendChild(text);
       box.appendChild(li);
       li.ondblclick = function(){
           this.parentNode.removeChild(this);
       }
   }
</script>
</body>
</html>